import { createRouter, createWebHistory } from "vue-router";
import StudentLayout from "@/views/Student/Layout/index.vue";
import Login from "@/views/Student/Login//index.vue";
import StudentCourse from "@/views/Student/Course/index.vue";
import StudentCourseDetail from "@/views/Student/Course/components/CourseDetail.vue";
import StudentExam from "@/views/Student/Exam/index.vue";
import StudentScore from "@/views/Student/Score/index.vue";
import StudentExamDetail from "@/views/Student/Exam/components/ExamDetail.vue";
import StudentWrong from "@/views/Student/Wrong/index.vue";
import Index from "@/views/Teacher/Index/Index.vue";
import Exam from "@/views/Teacher/exam/Exam.vue";
import ExamAdd from "@/views/Teacher/exam/ExamAdd.vue";
import ExamScores from "@/views/Teacher/exam/ExamScores.vue";
import ExamUpdate from "@/views/Teacher/exam/ExamUpdate.vue";
import CorrectExam from "@/views/Teacher/exam/CorrectExam.vue";
import Question from "@/views/Teacher/question/Question.vue";
import QuestionAdd from "@/views/Teacher/question/QuestionAdd.vue";
import QuestionIn from "@/views/Teacher/question/QuestionIn.vue";
import Introduction from "@/views/Teacher/Index/Introduction.vue";
import ExamQuestion from "@/views/Teacher/question/ExamQuestion.vue";
import Score from "@/views/Teacher/score/Score.vue";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/",
      redirect: "login",
    },
    {
      path: "/login",
      name: "login",
      component: Login,
    },
    {
      path: "/student/layout",
      component: StudentLayout,
      children: [
        {
          path: "",
          component: StudentCourse,
        },
        {
          path: "/student/courseDetail/:courseId",
          name: "studentCourseDetail",
          component: StudentCourseDetail,
        },
        {
          path: "/student/exam",
          component: StudentExam,
        },
        {
          path: "/student/exam/:examId",
          name: "studentExamDetail",
          component: StudentExamDetail,
        },
        {
          path: "/student/score",
          component: StudentScore,
        },
        {
          path: "/student/wrong",
          component: StudentWrong,
        },
      ],
    },
    {
      path: "/teacher",
      component: Index,
      children: [
        {
          path: "", //二级路由由默认显示
          component: Introduction,
        },
        {
          path: "exam", //查看组卷
          component: Exam,
        },
        {
          path: "examAdd", //新增组卷
          component: ExamAdd,
        },
        {
          path: "examScores", //成绩查看
          name: "examScores",
          component: ExamScores,
        },
        {
          path: "score/:examId", //具体成绩查看
          name: "score",
          component: Score,
        },
        {
          path: "examUpdate", //组卷编辑
          name: "examUpdate",
          component: ExamUpdate,
        },
        {
          path: "correctExam/:examId", //批改试卷
          name: "correctExam",
          component: CorrectExam
        },
        {
          path: "question", //题库查看
          name: "questionBank",
          component: Question,
        },
        {
          path: "examQuestion", //选择题目
          name: "selectQuestion",
          component: ExamQuestion,
        },
        {
          path: "questionAdd", //新增题目
          component: QuestionAdd,
        },
        {
          path: "questionIn", //文件导入
          name: "questionIn",
          component: QuestionIn,
        },
      ],
    },
  ],
});

export default router;
